<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>桌面插件配置管理</title>
	<%@include file="/WEB-INF/views/include/head.jsp" %>
	<script type="text/javascript">
		$(document).ready(function() {
			initGrid();		 
		});

	    function initGrid(){
	    	$("#jqGrid").jqGrid({
                url: '${ctxAdmin}/sys/desktopPlugConfig/loadData',
                mtype: "POST",
                datatype: "json",
                responsive:true,
                page: 1,
                colModel: [
					{ label: 'id', name: 'id', key: true, hidden:true}, 
                    { label: '角色名称',name: 'name',index: 'roleName',width: 120},
                    { label: '允许访问插件', name: 'arrowPlugsDesc',index: 'arrowPlugsDesc',width:600},                    
                    {label:'操作',name:'cz',search:false,sortable:false,title:false,formatter:czFmt,width:120}
                ],
				viewrecords: true,
                height: height,
                rowNum: 10,
                rowList:[10,20,30],
                loadonce:false,
                multiselect: true,
                autowidth: true,
                pager: "#jqGridPager"
            });
			$('#jqGrid').jqGrid('navGrid','#jqGridPager',{edit:false,add:false,del:false,search:false});
	    }
	 
	    function czFmt(c,o,r){
			var res='';
			var id=r.id;
		
			res+="<shiro:hasPermission name='sys:desktopPlugConfig:edit'>";
			res+="<a class='btn-success btn-sm' onclick=\"editData('"+id+"')\">修改</a>&nbsp;&nbsp;";
			res+="</shiro:hasPermission>";
			return res;
		}
		
		$(function() {
			$('#btnSubmit').click(function() {
				var roleName = $("#roleName").val();
						
				$('#jqGrid').jqGrid('setGridParam', {
					datatype : 'json',
					postData : {
						'roleName' : roleName
					}
				}).trigger("reloadGrid");
			});
			
		});
		
	
	
    function editData(id){
	            var url ='${ctxAdmin}/sys/desktopPlugConfig/form?roleId='+id;
	            openWindow(url,'编辑角色插件',680,460);		                
    }	
		
	</script>
</head>
<body>

	<div class="jqGrid_wrapper">
	
		<div class="search_row">
				
			<label class="col-sm-1">角色名称：</label>
			<div class="col-sm-2">
			<input id="roleName" name="roleName" type="text" class="form-control ipt-search" />
			</div>

						
			<div class="col-sm-search" style="width: 16%">
			&nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-sm btn-success" type="button"  value="查询" />
			&nbsp;&nbsp; <input id="btnReset" class="btn btn-sm btn-danger" type="button" value="重 置" />
			<shiro:hasPermission name="sys:desktopPlugConfig:edit">
			</shiro:hasPermission>
			
			</div>			
		</div>
		<div class="search_row_split"></div>
		<table id="jqGrid"></table>
		<div id="jqGridPager"></div>
	</div>
	
</body>
</html>